<?php

include '../../../configuration.php';

$smarty->template_dir = LOCAL_PATH.'administrator/main/templates/';
$smarty->compile_dir = LOCAL_PATH.'administrator/main/templates_c/';
$smarty->config_dir = LOCAL_PATH.'administrator/main/configs';

$smarty->compile_check = true;
//$smarty->debugging = true;

if (isset($_POST['new_faculty'])){
	$new_faculty = $_POST['new_faculty'];
	$id = $_POST['id'];
	mysql_query("UPDATE `faculties` SET faculty_name = '$new_faculty' WHERE faculty_id = $id");
	header("Location: modify_or_delete_faculty.php");
}
else if(isset($_GET['id'])){
	$id = $_GET['id'];
}else{
	header("Location: modify_or_delete_faculty.php");
}

$result = mysql_query("SELECT * FROM `faculties` WHERE faculty_id = $id");
$row = mysql_fetch_assoc($result);
$faculty = $row["faculty_name"];

$smarty->assign('faculty',$faculty);
$smarty->assign('id',$id);

include '../../check.php';
if ($checking == 1)
	$smarty->display('modifing_faculty.tpl');
else echo "You are not autorised"; exit;

?>